package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.zr.gdms.service.CourseService;
import com.zr.gdms.serviceimpl.CourseServiceImpl;

/**
 * @author  shichongming
 * @E-mail: 
 * @date 创建时间：2017年6月5日 下午3:09:51 
 * @version 1.0 
 * @parameter  
 * @since  
 * @return  
 */

public class AdminShowWaitAuditingCourseSCM extends HttpServlet{
	  CourseService cs=new CourseServiceImpl();
	// 展示所有待审核的课题
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	doPost(req, resp);
}
@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		HttpSession session=req.getSession();
		int p=Integer.parseInt(req.getParameter("page"));		
		int rows=Integer.parseInt(req.getParameter("rows"));
		int page=(p-1)*rows;
		String apptype="上传课题";
		int total=cs.sGetWaitAuditingCourseTotal();
		JSONArray j=cs.sShowWaitAuditingCourse(apptype,page, rows);
		JSONObject js=new JSONObject();
		js.put("total", total);
		js.put("rows", j);
		PrintWriter pw=resp.getWriter();
		pw.write(js.toString());	
	}


}
